package com.rd.student.jiaji.class2.huangyiming.Day230725;

import java.util.Scanner;

public class TestStatistics {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("输入字符:");
        String input=scanner.nextLine();

        int letter=0;
        int blank=0;
        int digit=0;
        int other=0;

        for (char c:input.toCharArray()){

            if (Character.isLetter(c)){
                letter++;
            }else if (Character.isWhitespace(c)|| c=='\n'||c=='\r'){
                blank++;
            }
            else if (Character.isDigit(c)){
                digit++;
            }
            else {
                other++;
            }
        }
        System.out.println("letter"+letter);
        System.out.println("blank"+blank);
        System.out.println("digit"+digit);
        System.out.println("other"+other);
    }
}
